<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Document</title>
</head>
<body>
    <input type="text" id="txt">
    <script>
        //输入框的内容发生改变时触发，如在输入框中输入123
        var txt = document.getElementById("txt");
        txt.onchange = function(){
            this.value = "change";
        }
    </script>
</body>
</html>